import * as API from '../axios';
import * as util from "@/common/util";

export default {
  //店铺列表
  getShopList: (params, page) => {
    const url = util.replacePageNumAndSize('/manage/branches/{pageNum}/{pageSize}', page)
    return API.axiosGetAPI(url, params)
  },
  //修改店铺状态
  shopState: (params) => {
    const headers = {
      'lang-key': params.state == 1 ? 'branch_resumePartnership' : 'branch_Terminate'
    }
    return API.axiosPutAPI('/manage/branches/state', params, headers);
  },
  //店铺详情
  shopDetail: id => {
    return API.axiosGetAPI(`/manage/branches/detail/${id}`)
  },
  //店铺编辑详情
  shopEditDetail: id => {
    return API.axiosGetAPI(`/manage/branches/${id}`)
  },
  //押金规则-列表(全部)
  getDepositList: params => {
    return API.axiosGetAPI('/manage/deposits/all', params)
  },
  //所有代理
  getAgentList: () => {
    return API.axiosGetAPI('/manage/agents/box');
  },
  //所有的机柜
  getCabinetsList: params => {
    return API.axiosGetAPI(`/manage/cabinets/box`, params);
  },
  //新增店铺
  addShop: params => {
    const headers = {
      'lang-key': 'create_store'
    }
    return API.axiosPostAPI('/manage/branches', params,headers);
  },
  //编辑店铺
  editShop: params => {
    const headers = {
      'lang-key': 'Edit_store'
    }
    return API.axiosPutAPI('/manage/branches', params,headers);
  },
  //管理员下拉
  userOption: () => {
    return API.axiosGetAPI('/manage/users/option?state=1');
  },
  //管理员设置
  setUser: (params) => {
    return API.axiosPutAPI('/manage/branches/account', params);
  },
  //生成绑定账号邀请链接
  setUrl: (params) => {
    return API.axiosPostAPI(`/manage/branches/gen-bind-account-invite-link?id=${params}`);
  },
  //获取当前登入的代理信息
  getAgentsMsg: () => {
    return API.axiosGetAPI(`/manage/agents/current/login`);
  },
  //代理-树型结构所有正常代理
  getAgentsTree: () => {
    return API.axiosGetAPI(`/manage/agents/tree-box`);
  },
};